use Test::More tests => 20;
#use Test::More qw(no_plan);

use Firepear::Carrot::Lexer;

BEGIN {
use_ok( 'Firepear::Carrot::Handler' );
}

my $mu = ['[',']',';',"'",'-'];

my $h = Firepear::Carrot::Handler->new( mu => $mu );

is ($h->{mu}{o}, '\[\[', 'open');
is ($h->{mu}{c}, '\]\]', 'close');
is ($h->{mu}{r}, '\;\;\;', 'rem');
is ($h->{mu}{s}, '\;', 'separator');
is ($h->{mu}{q}, "\\'", 'quote');
is ($h->{mu}{z}{o}, '\[', 'rawopen');
is ($h->{mu}{z}{c}, '\]', 'rawclose');

######################################################## 000 - Normal operation
is ($h->status, 0, 'normal ops - 0');

######################################################## 901 - No markup passed
$h = Firepear::Carrot::Handler->new();
is ($h->status, 901, 'no markup');
$mu = ['[','9',';',"'"];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 901, 'not enough elements in markup');
$mu = ['[','9',';',"'"];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 901, 'too many elements in markup');

################################################### 902 - Invalid markup passed
$mu = ['[','9',';',"'",'-'];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 902, 'invalid markup (numeric)');
$mu = ['[',']',' ',"'",'-'];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 902, 'invalid markup (whitespace)');
$mu = ['[',"\n",';',"'",'-'];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 902, 'invalid markup (newline)');
$mu = ['[','s',';',"'",'-'];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 902, 'invalid markup (s)');
$mu = ['[','w',';',"'",'-'];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 902, 'invalid markup (w)');
$mu = ['[','b',';',"'",'-'];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 902, 'invalid markup (b)');
$mu = ['[','d',';',"'",'-'];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 902, 'invalid markup (d)');
$mu = ['[',']',';',"'",''];
$h = Firepear::Carrot::Handler->new(mu => $mu);
is ($h->status, 902, 'invalid markup (null)');
